package net.slidinglive.utilities.enumeration;

import net.slidinglive.utilities.R;
import net.slidinglive.utilities.util.Constants;
import android.content.Context;

/**
 * @author Sebastian Hoffmann <bo.hoffi@gmail.com>
 */
public enum MessageStorage {

    INBOX(Constants.MESSAGE_STORAGE_INBOX), OUTBOX(Constants.MESSAGE_STORAGE_OUTBOX), ALL(Constants.MESSAGE_STORAGE_ALL), FAILED(
            Constants.MESSAGE_STORAGE_FAILED), QUEUED(Constants.MESSAGE_STORAGE_QUEUED), SENT(
            Constants.MESSAGE_STORAGE_SENT), DRAFT(Constants.MESSAGE_STORAGE_DRAFT), UNDELIVERED(
            Constants.MESSAGE_STORAGE_UNDELIVERED);

    private final String storageSource;

    private MessageStorage(final String storageSource) {

        this.storageSource = storageSource;
    }

    /**
     * @return the caption
     */
    public String getCaption(final Context context) {

        String caption = "";

        switch (this) {
            case INBOX:
                caption = context.getResources().getString(R.string.message_backup_storage_choice_inbox);
                break;

            case OUTBOX:
                caption = context.getResources().getString(R.string.message_backup_storage_choice_outbox);
                break;

            case ALL:
                caption = context.getResources().getString(R.string.message_backup_storage_choice_all);
                break;

            case FAILED:
                caption = context.getResources().getString(R.string.message_backup_storage_choice_failed);
                break;

            case QUEUED:
                caption = context.getResources().getString(R.string.message_backup_storage_choice_queued);
                break;

            case SENT:
                caption = context.getResources().getString(R.string.message_backup_storage_choice_sent);
                break;

            case DRAFT:
                caption = context.getResources().getString(R.string.message_backup_storage_choice_draft);
                break;

            case UNDELIVERED:
                caption = context.getResources().getString(R.string.message_backup_storage_choice_undelivered);
                break;

            default:
                caption = context.getResources().getString(R.string.message_backup_storage_choice_inbox);
                break;
        }
        return caption;
    }

    /**
     * @return the storageSource
     */
    public String getStorageSource() {

        return this.storageSource;
    }
}